<?php


namespace app\zhongcan\validate;


use think\Validate;

class NewsValidate extends Validate
{
    protected $rule =[
        'title' => 'require|max:30|min:1',
        'image' => 'require',
        'look_num' => 'require|integer|number',
        'author' => 'require',
        'abstract' => 'require',
        'content' => 'require',

    ];
    protected $message =[
        'title.require' =>'标题不能为空',
        'title.max' =>'标题最多可输入30个字符',
        'title.min' =>'标题最少输入1个字符',
        'image.require' =>'封面不能为空',
        'look_num.require' =>'浏览量不能为空',
        'look_num.integer' =>'浏览量是整形',
        'look_num.number' =>'浏览量是数字',
        'author.require' =>'作者不能为空',
        'abstract.require' =>'摘要不能为空',
        'content.require' =>'内容不能为空',
    ];
    protected $scene =[
        'add' =>['title','image','look_num','author','abstract','content'],
        'edit' =>['title'],
    ];
}